#include "AcData.h"

#include <float.h>
#include <limits.h>

#include "ComDefine.h"

bool CAcData::IsCommNormal()
{
    return (0 == m_uCommState);
}

bool CAcData::IsCommFault()
{
    return (1 == m_uCommState);
}

bool CAcData::IsRunning()
{
    return (0 == m_uRunState);
}

bool CAcData::IsStopped()
{
    return (1 == m_uRunState);
}

bool CAcData::IsFault()
{
    return (1 == m_uFaultState);
}

bool CAcData::IsNoFault()
{
    return (0 == m_uFaultState);
}

bool CAcData::IsAlarm()
{
    return (1 == m_uAlarmState);
}

bool CAcData::IsNoAlarm()
{
    return (0 == m_uAlarmState);
}

bool CAcData::IsOpening()
{
    return (1 == m_uSwitchState);
}

bool CAcData::IsClosed()
{
    return (0 == m_uSwitchState);
}

//bool CAcData::IsRunningYes()
//{
//    return (1 == m_uRunning);
//}

//bool CAcData::IsRunningNo()
//{
//    return (0 == m_uRunning);
//}

//bool CAcData::IsAlarmYes()
//{
//    return (1 == m_uAlarm);
//}

//bool CAcData::IsAlarmNo()
//{
//    return (0 == m_uAlarm);
//}

//bool CAcData::IsFaultYes()
//{
//    return (1 == m_uFault);
//}

//bool CAcData::IsFaultNo()
//{
//    return (0 == m_uFault);
//}

//获取***的显示文本
QString CAcData::GetCommStateText()
{
    if (0xFFFF == m_uCommState)
    {
        return QObject::tr("---");
    }
    else if (1 == m_uCommState)
    {
        return QObject::tr("故障");
    }
    else
    {
        return QObject::tr("正常");
    }
}

//QString CAcData::GetStrategyText()
//{
//    if (0xFFFF == m_uStrategy)
//    {
//        return QObject::tr("---");
//    }
//    else if (2 == m_uStrategy)
//    {
//        return QObject::tr("策略一");
//    }
//    if (1 == m_uStrategy)
//    {
//        return QObject::tr("自动");
//    }
//    else
//    {
//        return QObject::tr("不控制");
//    }
//}

//QString CAcData::GetReserveText(int iindex)
//{
//    if (iindex < 0 || iindex >= 10)
//    {
//        return "---";
//    }

//    quint16 usvalue = m_uReserve[iindex];
//    if (0xFFFF == usvalue)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == usvalue)
//    {
//        return QObject::tr("值1");
//    }
//    else if (0 == usvalue)
//    {
//        return QObject::tr("值0");
//    }
//    else
//    {
//        return QObject::tr("值%1").arg(usvalue);
//    }
//}

//QString CAcData::GetStrategySetText()
//{
//    if (0xFFFF == m_uStrategySet)
//    {
//        return QObject::tr("---");
//    }
//    else if (2 == m_uStrategySet)
//    {
//        return QObject::tr("策略一");
//    }
//    if (1 == m_uStrategySet)
//    {
//        return QObject::tr("自动");
//    }
//    else
//    {
//        return QObject::tr("不控制");
//    }
//}

//QString CAcData::GetReserveSetText(int iindex)
//{
//    if (iindex < 0 || iindex >= 10)
//    {
//        return "---";
//    }

//    quint16 usvalue = m_uReserveSet[iindex];
//    if (0xFFFF == usvalue)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == usvalue)
//    {
//        return QObject::tr("值1");
//    }
//    else if (0 == usvalue)
//    {
//        return QObject::tr("值0");
//    }
//    else
//    {
//        return QObject::tr("值%1").arg(usvalue);
//    }
//}

//QString CAcData::GetRunningText()
//{
//    if (0xFFFF == m_uRunning)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == m_uRunning)
//    {
//        return QObject::tr("运行");
//    }
//    else if (0 == m_uRunning)
//    {
//        return QObject::tr("停止");
//    }
//    else
//    {
//        return QObject::tr("%1").arg(m_uRunning);
//    }
//}

//QString CAcData::GetInsideFanText()
//{
//    if (0xFFFF == m_uInsideFan)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == m_uInsideFan)
//    {
//        return QObject::tr("运行");
//    }
//    else if (0 == m_uInsideFan)
//    {
//        return QObject::tr("停止");
//    }
//    else
//    {
//        return QObject::tr("%1").arg(m_uInsideFan);
//    }
//}

//QString CAcData::GetOutsideFanText()
//{
//    if (0xFFFF == m_uOutsideFan)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == m_uOutsideFan)
//    {
//        return QObject::tr("运行");
//    }
//    else if (0 == m_uOutsideFan)
//    {
//        return QObject::tr("停止");
//    }
//    else
//    {
//        return QObject::tr("%1").arg(m_uOutsideFan);
//    }
//}

//QString CAcData::GetEmergencyFanText()
//{
//    if (0xFFFF == m_uEmergencyFan)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == m_uEmergencyFan)
//    {
//        return QObject::tr("运行");
//    }
//    else if (0 == m_uEmergencyFan)
//    {
//        return QObject::tr("停止");
//    }
//    else
//    {
//        return QObject::tr("%1").arg(m_uEmergencyFan);
//    }
//}

//QString CAcData::GetCoolerText()
//{
//    if (0xFFFF == m_uCooler)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == m_uCooler)
//    {
//        return QObject::tr("运行");
//    }
//    else if (0 == m_uCooler)
//    {
//        return QObject::tr("停止");
//    }
//    else
//    {
//        return QObject::tr("%1").arg(m_uCooler);
//    }
//}

//QString CAcData::GetHeaterText()
//{
//    if (0xFFFF == m_uHeater)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == m_uHeater)
//    {
//        return QObject::tr("运行");
//    }
//    else if (0 == m_uHeater)
//    {
//        return QObject::tr("停止");
//    }
//    else
//    {
//        return QObject::tr("%1").arg(m_uHeater);
//    }
//}

//QString CAcData::GetDehumidifyText()
//{
//    if (0xFFFF == m_uDehumidify)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == m_uDehumidify)
//    {
//        return QObject::tr("运行");
//    }
//    else if (0 == m_uDehumidify)
//    {
//        return QObject::tr("停止");
//    }
//    else
//    {
//        return QObject::tr("%1").arg(m_uDehumidify);
//    }
//}

//QString CAcData::GetStateText(int iindex)
//{
//    if (iindex < 0 || iindex >= 10)
//    {
//        return "---";
//    }

//    quint16 usvalue = m_uState[iindex];
//    if (0xFFFF == usvalue)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == usvalue)
//    {
//        return QObject::tr("运行");
//    }
//    else if (0 == usvalue)
//    {
//        return QObject::tr("停止");
//    }
//    else
//    {
//        return QObject::tr("%1").arg(usvalue);
//    }
//}

//QString CAcData::GetAlarmText()
//{
//    if (0xFFFF == m_uAlarm)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == m_uAlarm)
//    {
//        return QObject::tr("告警");
//    }
//    else
//    {
//        return QObject::tr("正常");
//    }
//}

//QString CAcData::GetFaultText()
//{
//    if (0xFFFF == m_uFault)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == m_uFault)
//    {
//        return QObject::tr("故障");
//    }
//    else
//    {
//        return QObject::tr("正常");
//    }
//}

//QString CAcData::GetWarnText(int iindex)
//{
//    if (iindex < 0 || iindex >= 20)
//    {
//        return "---";
//    }

//    quint16 usvalue = m_uWarn[iindex];
//    if (0xFFFF == usvalue)
//    {
//        return QObject::tr("---");
//    }
//    else if (1 == usvalue)
//    {
//        return QObject::tr("告警");
//    }
//    else
//    {
//        return QObject::tr("正常");
//    }
//}

//QString CAcData::GetTempControlText(bool bIsRead /*= true*/)
//{
//    float fvalue = m_fTempControlSet;
//    if (bIsRead)
//    {
//        fvalue = m_fTempControl;
//    }

//    if (qFuzzyCompare(FLT_MAX, fvalue))
//    {
//        return QObject::tr("---");
//    }
//    else if (qFuzzyCompare(1, fvalue))
//    {
//        return QObject::tr("电芯温度");
//    }
//    else
//    {
//        return QObject::tr("柜内温度");
//    }
//}

//QString CAcData::GetOnOffText(bool bIsRead /*= true*/)
//{
//    float fvalue = m_fOnOffSet;
//    if (bIsRead)
//    {
//        fvalue = m_fOnOff;
//    }

//    if (qFuzzyCompare(FLT_MAX, fvalue))
//    {
//        return QObject::tr("---");
//    }
//    else if (qFuzzyCompare(1, fvalue))
//    {
//        return QObject::tr("开机");
//    }
//    else
//    {
//        return QObject::tr("关机");
//    }
//}

//QString CAcData::GetWorkModeText(bool bIsRead /*= true*/)
//{
//    float fvalue = m_fWorkModeSet;
//    if (bIsRead)
//    {
//        fvalue = m_fWorkMode;
//    }

//    //0待机 1制冷 2制热 3通风 4自动
//    if (qFuzzyCompare(FLT_MAX, fvalue))
//    {
//        return QObject::tr("---");
//    }
//    else if (qFuzzyCompare(4, fvalue))
//    {
//        return QObject::tr("自动");
//    }
//    else if (qFuzzyCompare(3, fvalue))
//    {
//        return QObject::tr("通风");
//    }
//    else if (qFuzzyCompare(2, fvalue))
//    {
//        return QObject::tr("制热");
//    }
//    else if (qFuzzyCompare(1, fvalue))
//    {
//        return QObject::tr("制冷");
//    }
//    else
//    {
//        return QObject::tr("待机");
//    }
//}

//设置温控方式:0柜内温度 1电芯温度
//void CAcData::SetTempControlToInside()
//{
//    m_fTempControlSet = 0; //0柜内温度 1电芯温度
//}

//void CAcData::SetTempControlToBat()
//{
//    m_fTempControlSet = 1; //0柜内温度 1电芯温度
//}

//设置开关机:0关机 1开机
//void CAcData::SetSwitchToOn()
//{
//    m_fOnOffSet = 1; //0关机 1开机
//}

//void CAcData::SetSwitchToOff()
//{
//    m_fOnOffSet = 0; //0关机 1开机
//}

//设置工作模式:0待机 1制冷 2制热 3通风 4自动
//void CAcData::SetWorkModeToWait()
//{
//    m_fWorkModeSet = 0;
//}

//void CAcData::SetWorkModeToCool()
//{
//    m_fWorkModeSet = 1;
//}

//void CAcData::SetWorkModeToHeat()
//{
//    m_fWorkModeSet = 2;
//}

//void CAcData::SetWorkModeToWind()
//{
//    m_fWorkModeSet = 3;
//}

//void CAcData::SetWorkModeToAuto()
//{
//    m_fWorkModeSet = 4;
//}

void CAcData::InitToInvalid()
{
    m_uCommState = 0xFFFF;
    for (int i = 0; i < ARRAYSIZE(m_uRev); ++i)
    {
        m_uRev[i] = 0xFFFF;
    }
    for (int i = 0; i < ARRAYSIZE(m_fRev); ++i)
    {
        m_fRev[i] = FLT_MAX;
    }

    m_uRunState = 0xFFFF;
    m_uFaultState = 0xFFFF;
    m_uAlarmState = 0xFFFF;
    m_uSwitchState = 0xFFFF;

    m_uInsideFanState = 0xFFFF;
    m_uOutsideFanState = 0xFFFF;
    m_uCoolerState = 0xFFFF;
    m_uHeaterState = 0xFFFF;
    m_uEmergencyFanState = 0xFFFF;

    m_uDebugState = 0xFFFF;
    m_uWorkState = 0xFFFF;
    m_uDryState = 0xFFFF;
    for (int i = 0; i < ARRAYSIZE(m_uData); ++i)
    {
        m_uData[i] = 0xFFFF;
    }

    //转发的100个FLOAT数据
    m_fInsideTemp = FLT_MAX;
    m_fInsideHumi = FLT_MAX;
    m_fOutsideTemp = FLT_MAX;
    m_fOutsideHumi = FLT_MAX;
    m_fCondenseTemp = FLT_MAX;

    m_fEvaporateTemp = FLT_MAX;
    m_fVentilateTemp = FLT_MAX;
    m_fInsideReturnTemp = FLT_MAX;
    m_fInsideReturnHumi = FLT_MAX;
    m_fCoolStartTemp = FLT_MAX;

    m_fCoolStopTemp = FLT_MAX;
    m_fCoolDiffTemp = FLT_MAX;
    m_fHeatStartTemp = FLT_MAX;
    m_fHeatStopTemp = FLT_MAX;
    m_fHeatDiffTemp = FLT_MAX;

    m_fDryStartHumi = FLT_MAX;
    m_fDryStopHumi = FLT_MAX;
    m_fDryDiffHumi = FLT_MAX;
    m_fDebugSglMaxTemp = FLT_MAX;
    m_fDebugSglMinTemp = FLT_MAX;

    m_fDebugSglAvgTemp = FLT_MAX;
    m_fDebugSglMaxTempDiff = FLT_MAX;
    m_fAcVol = FLT_MAX;
    m_fDcVol = FLT_MAX;
    m_fTargetStartTemp = FLT_MAX;

    m_fTargetStopTemp = FLT_MAX;
    m_fTargetDiffTemp = FLT_MAX;
    m_fTargetStartHumi = FLT_MAX;
    m_fTargetStopHumi = FLT_MAX;
    m_fTargetDiffHumi = FLT_MAX;

    m_fCheckStartTemp = FLT_MAX;
    m_fCheckStopTemp = FLT_MAX;
    m_fCheckDiffTemp = FLT_MAX;
    m_fCheckStartHumi = FLT_MAX;
    m_fCheckStopHumi = FLT_MAX;

    m_fCheckDiffHumi = FLT_MAX;
    for (int i = 0; i < ARRAYSIZE(m_fData); ++i)
    {
        m_fData[i] = FLT_MAX;
    }

    m_fSetStartTemp = FLT_MAX;
    m_fSetStartTempCopy = FLT_MAX;
    m_fSetStopTemp = FLT_MAX;
    m_fSetStopTempCopy = FLT_MAX;
    m_fSetStartHumi = FLT_MAX;
    m_fSetStartHumiCopy = FLT_MAX;
    m_fSetStopHumi = FLT_MAX;
    m_fSetStopHumiCopy = FLT_MAX;
    m_uSetSwitchState = 0XFFFF; //20005 下设开关机:0关机,1开机
    m_uSetSwitchStateCopy = 0XFFFF;
    m_fSetCoolStartTemp = FLT_MAX; //20006 下设制冷开始点 UINT16 0.01 -100 ℃
    m_fSetCoolStartTempCopy = FLT_MAX;
    m_fSetCoolStopTemp = FLT_MAX; //2007 下设制冷停止点  UINT16 0.01 -100 ℃
    m_fSetCoolStopTempCopy = FLT_MAX;
    m_fSetCoolDiffTemp = FLT_MAX; //2008 下设制冷回差点  UINT16 0.01 -100 ℃
    m_fSetCoolDiffTempCopy = FLT_MAX;
    m_fSetHotStartTemp = FLT_MAX; //20009 下设制热开始点  UINT16 0.01 -100 ℃
    m_fSetHotStartTempCopy = FLT_MAX;
    m_fSetHotStopTemp = FLT_MAX; //20010 下设制热停止点  UINT16 0.01 -100 ℃
    m_fSetHotStopTempCopy = FLT_MAX;
    m_fSetHotDiffTemp = FLT_MAX; //20011 下设制热回差点  UINT16 0.01 -100 ℃
    m_fSetHotDiffTempCopy = FLT_MAX;
    m_fSetDryStartHumi = FLT_MAX; //20012 下设除湿开始点  UINT16 0.01 -100 ℃
    m_fSetDryStartHumiCopy = FLT_MAX;
    m_fSetDryStopHumi = FLT_MAX; //20013 下设除湿停止点  UINT16 0.01 -100 ℃
    m_fSetDryStopHumiCopy = FLT_MAX;
    m_fSetDryDiffHumi = FLT_MAX; //20014 下设除湿回差点  UINT16 0.01 -100 ℃
    m_fSetDryDiffHumiCopy = FLT_MAX;
    m_fSetCtrlTempMax = FLT_MAX; //20016 下设最高控制温度，单位为℃
    m_fSetCtrlTempMaxCopy = FLT_MAX;
    m_fSetCtrlTempMin = FLT_MAX; //20017 下设最低控制温度，单位为℃
    m_fSetCtrlTempMinCopy = FLT_MAX;
    m_fSetCtrlTempAvg = FLT_MAX; //20018 下设平均控制温度，单位为℃
    m_fSetCtrlTempAvgCopy = FLT_MAX;
    m_uSetStartCoolCmd = 0XFFFF; //20019 启动制冷命令 0关闭,1启动
    m_uSetStartCoolCmdCopy = 0XFFFF;
    m_uSetStartWindCmd = 0XFFFF; //20020 启动送风命令 0关闭,1启动
    m_uSetStartWindCmdCopy = 0XFFFF;
    m_uSetStartWaitCmd = 0XFFFF; //20021 启动待机命令 0关闭,1启动
    m_uSetStartWaitCmdCopy = 0XFFFF;
    m_uSetStartHotCmd = 0XFFFF; //20022 启动加热命令 0关闭,1启动
    m_uSetStartHotCmdCopy = 0XFFFF;
    m_fSetCtrlHumi = FLT_MAX; //20023 下设控制湿度，单位为%
    m_fSetCtrlHumiCopy = FLT_MAX;
    m_uSetStartDryCmd = 0XFFFF; //20024 启动加热命令 0关闭,1启动
    m_uSetStartDryCmdCopy = 0XFFFF;

    for (int i = 0; i < ARRAYSIZE(m_uSetData); ++i)
    {
        m_uSetData[i] = 0xFFFF;
    }

    for (int i = 0; i < ARRAYSIZE(m_uSetDataCopy); ++i)
    {
        m_uSetDataCopy[i] = 0xFFFF;
    }
}

void CAcData::InitToZero()
{
    m_uCommState = 0;
    for (int i = 0; i < ARRAYSIZE(m_uRev); ++i)
    {
        m_uRev[i] = 0;
    }
    for (int i = 0; i < ARRAYSIZE(m_fRev); ++i)
    {
        m_fRev[i] = 0.0;
    }

    m_uRunState = 0;
    m_uFaultState = 0;
    m_uAlarmState = 0;
    m_uSwitchState = 0;

    m_uInsideFanState = 0;
    m_uOutsideFanState = 0;
    m_uCoolerState = 0;
    m_uHeaterState = 0;
    m_uEmergencyFanState = 0;

    m_uDebugState = 0;
    m_uWorkState = 0;
    m_uDryState = 0;
    for (int i = 0; i < ARRAYSIZE(m_uData); ++i)
    {
        m_uData[i] = 0;
    }

    //转发的100个FLOAT数据
    m_fInsideTemp = 0.0;
    m_fInsideHumi = 0.0;
    m_fOutsideTemp = 0.0;
    m_fOutsideHumi = 0.0;
    m_fCondenseTemp = 0.0;

    m_fEvaporateTemp = 0.0;
    m_fVentilateTemp = 0.0;
    m_fInsideReturnTemp = 0.0;
    m_fInsideReturnHumi = 0.0;
    m_fCoolStartTemp = 0.0;

    m_fCoolStopTemp = 0.0;
    m_fCoolDiffTemp = 0.0;
    m_fHeatStartTemp = 0.0;
    m_fHeatStopTemp = 0.0;
    m_fHeatDiffTemp = 0.0;

    m_fDryStartHumi = 0.0;
    m_fDryStopHumi = 0.0;
    m_fDryDiffHumi = 0.0;
    m_fDebugSglMaxTemp = 0.0;
    m_fDebugSglMinTemp = 0.0;

    m_fDebugSglAvgTemp = 0.0;
    m_fDebugSglMaxTempDiff = 0.0;
    m_fAcVol = 0.0;
    m_fDcVol = 0.0;
    m_fTargetStartTemp = 0.0;

    m_fTargetStopTemp = 0.0;
    m_fTargetDiffTemp = 0.0;
    m_fTargetStartHumi = 0.0;
    m_fTargetStopHumi = 0.0;
    m_fTargetDiffHumi = 0.0;

    m_fCheckStartTemp = 0.0;
    m_fCheckStopTemp = 0.0;
    m_fCheckDiffTemp = 0.0;
    m_fCheckStartHumi = 0.0;
    m_fCheckStopHumi = 0.0;

    m_fCheckDiffHumi = 0.0;
    for (int i = 0; i < ARRAYSIZE(m_fData); ++i)
    {
        m_fData[i] = 0.0;
    }

    m_fSetStartTemp = 0.0;
    m_fSetStartTempCopy = 0.0;
    m_fSetStopTemp = 0.0;
    m_fSetStopTempCopy = 0.0;
    m_fSetStartHumi = 0.0;
    m_fSetStartHumiCopy = 0.0;
    m_fSetStopHumi = 0.0;
    m_fSetStopHumiCopy = 0.0;
    m_uSetSwitchState = 0; //20005 下设开关机:0关机,1开机
    m_uSetSwitchStateCopy = 0;
    m_fSetCoolStartTemp = 0.0; //20006 下设制冷开始点 UINT16 0.01 -100 ℃
    m_fSetCoolStartTempCopy = 0.0;
    m_fSetCoolStopTemp = 0.0; //2007 下设制冷停止点  UINT16 0.01 -100 ℃
    m_fSetCoolStopTempCopy = 0.0;
    m_fSetCoolDiffTemp = 0.0; //2008 下设制冷回差点  UINT16 0.01 -100 ℃
    m_fSetCoolDiffTempCopy = 0.0;
    m_fSetHotStartTemp = 0.0; //20009 下设制热开始点  UINT16 0.01 -100 ℃
    m_fSetHotStartTempCopy = 0.0;
    m_fSetHotStopTemp = 0.0; //20010 下设制热停止点  UINT16 0.01 -100 ℃
    m_fSetHotStopTempCopy = 0.0;
    m_fSetHotDiffTemp = 0.0; //20011 下设制热回差点  UINT16 0.01 -100 ℃
    m_fSetHotDiffTempCopy = 0.0;
    m_fSetDryStartHumi = 0.0; //20012 下设除湿开始点  UINT16 0.01 -100 ℃
    m_fSetDryStartHumiCopy = 0.0;
    m_fSetDryStopHumi = 0.0; //20013 下设除湿停止点  UINT16 0.01 -100 ℃
    m_fSetDryStopHumiCopy = 0.0;
    m_fSetDryDiffHumi = 0.0; //20014 下设除湿回差点  UINT16 0.01 -100 ℃
    m_fSetDryDiffHumiCopy = 0.0;
    m_fSetCtrlTempMax = 0.0; //20016 下设最高控制温度，单位为℃
    m_fSetCtrlTempMaxCopy = 0.0;
    m_fSetCtrlTempMin = 0.0; //20017 下设最低控制温度，单位为℃
    m_fSetCtrlTempMinCopy = 0.0;
    m_fSetCtrlTempAvg = 0.0; //20018 下设平均控制温度，单位为℃
    m_fSetCtrlTempAvgCopy = 0.0;
    m_uSetStartCoolCmd = 0; //20019 启动制冷命令 0关闭,1启动
    m_uSetStartCoolCmdCopy = 0;
    m_uSetStartWindCmd = 0; //20020 启动送风命令 0关闭,1启动
    m_uSetStartWindCmdCopy = 0;
    m_uSetStartWaitCmd = 0; //20021 启动待机命令 0关闭,1启动
    m_uSetStartWaitCmdCopy = 0;
    m_uSetStartHotCmd = 0; //20022 启动加热命令 0关闭,1启动
    m_uSetStartHotCmdCopy = 0;
    m_fSetCtrlHumi = 0.0; //20023 下设控制湿度，单位为%
    m_fSetCtrlHumiCopy = 0.0;
    m_uSetStartDryCmd = 0; //20024 启动加热命令 0关闭,1启动
    m_uSetStartDryCmdCopy = 0;

    for (int i = 0; i < ARRAYSIZE(m_uSetData); ++i)
    {
        m_uSetData[i] = 0;
    }

    for (int i = 0; i < ARRAYSIZE(m_uSetDataCopy); ++i)
    {
        m_uSetDataCopy[i] = 0;
    }
}

void CAcData::InitToValue(quint16 uvalue, float fvalue)
{
    m_uCommState = uvalue;
    for (int i = 0; i < ARRAYSIZE(m_uRev); ++i)
    {
        m_uRev[i] = uvalue;
    }
    for (int i = 0; i < ARRAYSIZE(m_fRev); ++i)
    {
        m_fRev[i] = fvalue;
    }

    m_uRunState = uvalue;
    m_uFaultState = uvalue;
    m_uAlarmState = uvalue;
    m_uSwitchState = uvalue;

    m_uInsideFanState = uvalue;
    m_uOutsideFanState = uvalue;
    m_uCoolerState = uvalue;
    m_uHeaterState = uvalue;
    m_uEmergencyFanState = uvalue;

    m_uDebugState = uvalue;
    m_uWorkState = uvalue;
    m_uDryState = uvalue;
    for (int i = 0; i < ARRAYSIZE(m_uData); ++i)
    {
        m_uData[i] = uvalue;
    }

    //转发的100个FLOAT数据
    m_fInsideTemp = fvalue;
    m_fInsideHumi = fvalue;
    m_fOutsideTemp = fvalue;
    m_fOutsideHumi = fvalue;
    m_fCondenseTemp = fvalue;

    m_fEvaporateTemp = fvalue;
    m_fVentilateTemp = fvalue;
    m_fInsideReturnTemp = fvalue;
    m_fInsideReturnHumi = fvalue;
    m_fCoolStartTemp = fvalue;

    m_fCoolStopTemp = fvalue;
    m_fCoolDiffTemp = fvalue;
    m_fHeatStartTemp = fvalue;
    m_fHeatStopTemp = fvalue;
    m_fHeatDiffTemp = fvalue;

    m_fDryStartHumi = fvalue;
    m_fDryStopHumi = fvalue;
    m_fDryDiffHumi = fvalue;
    m_fDebugSglMaxTemp = fvalue;
    m_fDebugSglMinTemp = fvalue;

    m_fDebugSglAvgTemp = fvalue;
    m_fDebugSglMaxTempDiff = fvalue;
    m_fAcVol = fvalue;
    m_fDcVol = fvalue;
    m_fTargetStartTemp = fvalue;

    m_fTargetStopTemp = fvalue;
    m_fTargetDiffTemp = fvalue;
    m_fTargetStartHumi = fvalue;
    m_fTargetStopHumi = fvalue;
    m_fTargetDiffHumi = fvalue;

    m_fCheckStartTemp = fvalue;
    m_fCheckStopTemp = fvalue;
    m_fCheckDiffTemp = fvalue;
    m_fCheckStartHumi = fvalue;
    m_fCheckStopHumi = fvalue;

    m_fCheckDiffHumi = fvalue;
    for (int i = 0; i < ARRAYSIZE(m_fData); ++i)
    {
        m_fData[i] = fvalue;
    }

    m_fSetStartTemp = fvalue;
    m_fSetStartTempCopy = fvalue;
    m_fSetStopTemp = fvalue;
    m_fSetStopTempCopy = fvalue;
    m_fSetStartHumi = fvalue;
    m_fSetStartHumiCopy = fvalue;
    m_fSetStopHumi = fvalue;
    m_fSetStopHumiCopy = fvalue;
    m_uSetSwitchState = uvalue; //20005 下设开关机:0关机,1开机
    m_uSetSwitchStateCopy = uvalue;
    m_fSetCoolStartTemp = fvalue; //20006 下设制冷开始点 UINT16 0.01 -100 ℃
    m_fSetCoolStartTempCopy = fvalue;
    m_fSetCoolStopTemp = fvalue; //2007 下设制冷停止点  UINT16 0.01 -100 ℃
    m_fSetCoolStopTempCopy = fvalue;
    m_fSetCoolDiffTemp = fvalue; //2008 下设制冷回差点  UINT16 0.01 -100 ℃
    m_fSetCoolDiffTempCopy = fvalue;
    m_fSetHotStartTemp = fvalue; //20009 下设制热开始点  UINT16 0.01 -100 ℃
    m_fSetHotStartTempCopy = fvalue;
    m_fSetHotStopTemp = fvalue; //20010 下设制热停止点  UINT16 0.01 -100 ℃
    m_fSetHotStopTempCopy = fvalue;
    m_fSetHotDiffTemp = fvalue; //20011 下设制热回差点  UINT16 0.01 -100 ℃
    m_fSetHotDiffTempCopy = fvalue;
    m_fSetDryStartHumi = fvalue; //20012 下设除湿开始点  UINT16 0.01 -100 ℃
    m_fSetDryStartHumiCopy = fvalue;
    m_fSetDryStopHumi = fvalue; //20013 下设除湿停止点  UINT16 0.01 -100 ℃
    m_fSetDryStopHumiCopy = fvalue;
    m_fSetDryDiffHumi = fvalue; //20014 下设除湿回差点  UINT16 0.01 -100 ℃
    m_fSetDryDiffHumiCopy = fvalue;
    m_fSetCtrlTempMax = fvalue; //20016 下设最高控制温度，单位为℃
    m_fSetCtrlTempMaxCopy = fvalue;
    m_fSetCtrlTempMin = fvalue; //20017 下设最低控制温度，单位为℃
    m_fSetCtrlTempMinCopy = fvalue;
    m_fSetCtrlTempAvg = fvalue; //20018 下设平均控制温度，单位为℃
    m_fSetCtrlTempAvgCopy = fvalue;
    m_uSetStartCoolCmd = uvalue; //20019 启动制冷命令 0关闭,1启动
    m_uSetStartCoolCmdCopy = uvalue;
    m_uSetStartWindCmd = uvalue; //20020 启动送风命令 0关闭,1启动
    m_uSetStartWindCmdCopy = uvalue;
    m_uSetStartWaitCmd = uvalue; //20021 启动待机命令 0关闭,1启动
    m_uSetStartWaitCmdCopy = uvalue;
    m_uSetStartHotCmd = uvalue; //20022 启动加热命令 0关闭,1启动
    m_uSetStartHotCmdCopy = uvalue;
    m_fSetCtrlHumi = fvalue; //20023 下设控制湿度，单位为%
    m_fSetCtrlHumiCopy = fvalue;
    m_uSetStartDryCmd = uvalue; //20024 启动加热命令 0关闭,1启动
    m_uSetStartDryCmdCopy = uvalue;

    for (int i = 0; i < ARRAYSIZE(m_uSetData); ++i)
    {
        m_uSetData[i] = uvalue;
    }

    for (int i = 0; i < ARRAYSIZE(m_uSetDataCopy); ++i)
    {
        m_uSetDataCopy[i] = uvalue;
    }
}
